package com.huawei.fakedouyin.util;

import android.os.Handler;
import android.os.Looper;

import java.util.concurrent.Executor;

/**
 * Author: WYTong
 * Date: 2022/10/31 16:22
 */
public class MainExecutor implements Executor {

    private static final MainExecutor INSTANCE = new MainExecutor();

    private final Handler handler = new Handler(Looper.getMainLooper());
    @Override
    public void execute(Runnable command) {
        handler.post(command);
    }

    /**
     *
     * @return 在主线程运行的Executor
     */
    public static MainExecutor get() {
        return INSTANCE;
    }
}
